package net.csdn.business.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author likun
 * @date 2022/6/9 13:58
 */
public interface ResourceEnum {
    @Getter
    @AllArgsConstructor
    enum ObjectTypeEnum {
        /**
         * 评论
         */
        COMMENT("comment", "评论"),
        ISSUE("issue", "issue"),
        PROJECT("project", "项目"),
        ;

        final String code;
        final String desc;

        public static ObjectTypeEnum ofCode(String code) {
            for (ObjectTypeEnum objectTypeEnum : ObjectTypeEnum.values()) {
                if (objectTypeEnum.code.equalsIgnoreCase(code)) {
                    return objectTypeEnum;
                }
            }
            throw new IllegalArgumentException("ResourceEnum#ObjectTypeEnum param error");
        }
    }

    @Getter
    @AllArgsConstructor
    enum KeyEnum {
        /**
         * 统计key
         */
        DIGG_COUNT("digg_count", "点赞"),
        NO_DIGG_COUNT("no_digg_count", "点踩"),

        /**
         * issue统计（项目维度）
         */
        ISSUE_COUNT("issue_count", "issue"),

        /**
         * issue开放
         */
        ISSUE_OPEN_COUNT("issue_open_count", "开放数量"),
        ISSUE_CLOSE_COUNT("issue_close_count", "关闭数量"),
        COMMENT_COUNT("comment_count", "评论数"),
        ;
        final String code;
        final String desc;
    }
}
